//
//  BIZRecruitDetailVC.m
//  biz
//
//  Created by LXL on 2017/6/12.
//  Copyright © 2017年 jieshuibao. All rights reserved.
//

#import "BIZRecruitDetailVC.h"
#import "BIZRecruitModel.h"
//#import "BIZRecruitDetailFirstCell.h"
//#import "BIZRecruitDetailSecondCell.h"
//#import "BIZRecruitDetailThirdCell.h"
//#import "BIZRecruitDetailFourthCell.h"

@interface BIZRecruitDetailVC ()
@property (weak, nonatomic) IBOutlet UILabel *positionLabel;
@property (weak, nonatomic) IBOutlet UILabel *companyLabel;
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
@property (weak, nonatomic) IBOutlet UIImageView *recruitImageView;
@property (weak, nonatomic) IBOutlet UILabel *salaryLabel;
@property (weak, nonatomic) IBOutlet UILabel *introduceLabel;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;
@property (weak, nonatomic) IBOutlet UILabel *positionDesLabel;

@end

@implementation BIZRecruitDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"职位详情";
    self.tableView.estimatedRowHeight = 500;

    [self loadPositionDetailData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewAutomaticDimension;
}

- (void)loadPositionDetailData {
    self.positionLabel.text = self.positionModel.position;
    self.companyLabel.text = self.positionModel.name;
    if ([self.positionModel.faceTalk isEqualToString:@"0"]) {//面议
        self.salaryLabel.text = @"面议";
    } else {
        self.salaryLabel.text = [NSString stringWithFormat:@"%ld~%ld元", (long)self.positionModel.minMoney,  (long)self.positionModel.maxMoney];
    }
    
    self.dateLabel.text = [NSDate stringFromTimestamp:self.positionModel.createDate];
    self.introduceLabel.text = self.positionModel.companyDes;
    self.addressLabel.text = self.positionModel.address;
    self.positionDesLabel.text = self.positionModel.positionDes;
    
    [self.tableView reloadData];
    
    //    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
//    [MBProgressHUD showAnimationHUD];
//    [RequestTool POST:kLoginOutUrl parameters:dic progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
//        DeLog(@"请求成功的数据：%@", responseObject);
//        
//        [MBProgressHUD hideHUD];
//        NSInteger code = [responseObject[@"code"] integerValue];
//        NSString *des = responseObject[@"des"];
//        if (code) {
//            
//        } else {
//            if (code == 2) {
//                BIZLoginViewController *vc = [BIZLoginViewController viewControllerFromStoryboard];
//                MPWeakSelf(self);
//                vc.loginSuccessBlock = ^(){
//                    [weakself loadPositionDetailData];
//                };
//                [self presentViewController:vc animated:YES completion:nil];
//                
//            } else {
//                [MBProgressHUD showErrorMessage:des];
//            }
//        }
//        
//    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
//        DeLog(@"请求失败：%@", error);
//        
//        [MBProgressHUD hideHUD];
//        if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable) {
//            [MBProgressHUD showErrorMessage:@"网络不给力"];
//            
//        } else {
//            [MBProgressHUD showErrorMessage:@"服务器繁忙"];
//        }
//        
//    }];

}




@end
